//
//  UIImage+Color2Image.m
//  MyApp
//
//  Created by Don on 2017/9/4.
//  Copyright © 2017年 com.memego. All rights reserved.
//

#import "UIImage+Color2Image.h"

@implementation UIImage (Color2Image)
+ (UIImage *)mmg_imageWithColor:(UIColor *)aColor {
    return [UIImage mmg_imageWithColor:aColor withFrame:CGRectMake(0, 0, 1, 1)];
}

+ (UIImage *)mmg_imageWithColor:(UIColor *)aColor withFrame:(CGRect)aFrame {
    UIGraphicsBeginImageContext(aFrame.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [aColor CGColor]);
    CGContextFillRect(context, aFrame);
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}
@end
